<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/10/14
  Time: 17:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>后台管理 - 易买网</title>
    <link type="text/css" rel="stylesheet" href="../css/style.css"/>
    <script type="text/javascript" src="../scripts/function.js"></script>
</head>
<body>
<div id="header" class="wrap">
    <div id="logo"><img src="../images/logo.gif"/></div>
    <div class="help"><a href="../../index.jsp">返回前台页面</a></div>
    <div class="navbar">
        <ul class="clearfix">
            <li><a href="index.html">首页</a></li>
            <li class="current"><a href="user.html">用户</a></li>
            <li><a href="product.html">商品</a></li>
            <li><a href="order.html">订单</a></li>
            <li><a href="guestbook.jsp">留言</a></li
            <li><a href="news.html">新闻</a></li>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="welcome wrap">
        管理员${manageUser.username}您好，今天是2012-12-21，欢迎回到管理后台。
    </div>
</div>
<div id="position" class="wrap">
    您现在的位置：<a href="index.jsp">易买网</a> &gt; 管理后台
</div>
<div id="main" class="wrap">
    <div id="menu-mng" class="lefter">
        <div class="box">
            <dl>
                <dt>用户管理</dt>
                <dd><em><a href="user-add.jsp">新增</a></em><a href="user.jsp">用户管理</a></dd>
                <dt>商品信息</dt>
                <dd><em><a href="user-add.jsp">新增</a></em><a href="productClass.html">分类管理</a></dd>
                <dd><em><a href="product-add.html">新增</a></em><a href="product.html">商品管理</a></dd>
                <dt>订单管理</dt>
                <dd><a href="order.html">订单管理</a></dd>
                <dt>留言管理</dt>
                <dd><a href="guestbook.jsp">留言管理</a></dd>
                <dt>新闻管理</dt>
                <dd><em><a href="news-add.jsp">新增</a></em><a href="news.jsp">新闻管理</a></dd>
            </dl>
        </div>
    </div>
    <div class="main">
        <h2>新增用户</h2>
        <div class="manage">
            <form action="UserAddServlet" method="post" onsubmit="return CheckAdd()">
                <table class="form">
                    <tr>
                        <td class="field">用户名：</td>
                        <td><input type="text" class="text" name="userName" value=""/>仅支持英文和数字</td>
                    </tr>
                    <tr>
                        <td class="field">密码：</td>
                        <td><input type="text" class="text" name="passWord" value=""/>以字母开头</td>
                    </tr>
                    <tr>
                    <tr style="display: none">
                        <td class="field">权限：</td>
                        <td><input class="text" type="hidden" name="poWer" value="1" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);"/><span></span></td>
                    </tr>
                    <td class="field">真实姓名：</td>
                    <td><input type="text" class="text" name="name" value=""/>仅支持中文字符</td>
                    </tr>
                    <tr>
                        <td class="field">身份证号：</td>
                        <td><input class="text" type="text" name="num" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);"/><span></span></td>
                    </tr>

                    <tr>
                        <td class="field">出生日期：</td>
                        <td>
                            <select name="birthyear">
                                <option value="2000">2000</option>
                                <option value="1999">1999</option>
                            </select>年
                            <select name="birthmonth">
                                <option value="12">12</option>
                                <option value="11">11</option>
                            </select>月
                            <select name="birthday">
                                <option value="2">2</option>
                                <option value="1">1</option>
                            </select>日
                        </td>
                    </tr>
                    <tr>
                        <td class="field">性别：</td>
                        <td><input type="radio" name="sex" value="1" checked="checked"/>男 <input type="radio" name="sex"
                                                                                                 value="1"/>女
                        </td>
                    </tr>
                    <tr>
                        <td class="field">手机号码：</td>
                        <td><input type="text" class="text" name="mobile" value=""/></td>
                    </tr>
                    <td></td>
                    <td><label class="ui-blue"><input type="submit" name="submit" value="添加"/></label></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
    Copyright &copy; 2010 北大青鸟 All Rights Reserved. 京ICP证1000001号
</div>

<script type="text/javascript" charset="UTF-8">

    function CheckAdd() {

        var uname = document.getElementsByName("userName").value;
        var password = document.getElementsByName("passWord").value;
        var relname = document.getElementsByName("name").value;
        var idcardnum = document.getElementsByName("num").value;
        var telnumber = document.getElementsByName("mobile").value;

        var cname = /^[A-Za-z0-9]+$/; //英文和数字
        var cpwd = /^[a-zA-Z]\w{5,17}$/; //密码(以字母开头，长度在6~18之间，只能包含字母、数字和下划线)
        var crealname = /^[\u4e00-\u9fa5]$/; //汉字
        var cidnum = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;  //身份证验证
        var cphonenum = /^13\d{9}$/; //手机号码

        if (cname.test(uname) && cpwd.test(password) && crealname.test(relname) && cidnum.test(idcardnum) && cphonenum.test(telnumber)) {
            // alert("添加成功！")
            return true;
        } else {
            alert("信息有误!请仔细看添加要求并重新添加！");
            return false;
        }
    }
</script>
</body>
</html>

